home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vol15n10.zip / WHATIS.ZIP / WHATISIT.BAS next >
BASIC Source File  |  1995-12-26  |  1KB  |  40 lines

  1. 'WHATISIT.BAS
  2. 'Program to display the Module Definition String
  3. 'from a Win 3.x executable file (.EXE, .SCR, .DLL, etc.)
  4.  
  5.     INPUT "File to examine"; f$
  6.     OPEN f$ FOR BINARY ACCESS READ AS #1
  7.     IF LOF(1) = 0 THEN GOTO NoExist
  8.     IF LOF(1) < &H2F THEN GOTO ErrorExit
  9.     SEEK #1, &H3C + 1
  10.     GET #1, , wh%       'Get offset to Windows header,
  11.     SEEK #1, wh% + 1    'which should begin with "NE"
  12.     a$ = INPUT$(2, 1)
  13.     IF a$ = "PE" THEN GOTO ThirtyTwo
  14.     IF a$ <> "NE" THEN GOTO ErrorExit
  15.     wh% = wh% + &H2C    'DWORD at offset 2CH points to
  16.                         'nonresident name table
  17.     IF wh% >= LOF(1) THEN GOTO ErrorExit
  18.     SEEK #1, wh% + 1
  19.     GET #1, , rn&
  20.     IF rn& >= LOF(1) THEN GOTO ErrorExit
  21.     SEEK #1, rn& + 1    'First is Module Definition String.
  22.     l$ = INPUT$(1, 1)        'Read lenth byte.
  23.     a$ = INPUT$(ASC(l$), 1)  'Read string data
  24.     PRINT a$                 ' and display it
  25.     CLOSE
  26.     END
  27. NoExist:
  28.     PRINT "File is non-existent or zero-length."
  29.     CLOSE
  30.     END
  31. ThirtyTwo:
  32.     PRINT "Not compatible - 32-bit executable file."
  33.     CLOSE
  34.     END
  35. ErrorExit:
  36.     PRINT "Not a Win 3.1 executable file."
  37.     CLOSE
  38.     END
  39.  
  40.